Hi all,
Permission P_all = read|create|modify|delete|control
Permission P_read = read
AccessRec = ar
//put object Text in read only except for admins
AttrDef ad = find(m, "Object Text")
//disable inheritance
err = specificVal(m,ad)
if (!null err){
errorBox(err)
halt
}
for ar in values ad do
{
if(username ar == dbgroup) then err = setVal(m,ad, P_all, username(ar))
else err = setVal(m,ad, P_read, username(ar))
if (!null err){
errorBox(err)
halt
}
}
if (!exists attribute "Change Proposal Status")
{
AttrDef ad = create object type "ChangeProposalStatusenum" attribute "Change Proposal Status"
}
//ad = find(m, "Change Proposal Status")
//disable inheritance
err = specificVal(m,ad)
if (!null err){
errorBox(err)
halt
}
//error on this line ->
for ar in values ad do
{
if(username ar == dbgroup) then err = setVal(m,ad, P_all, username(ar))
else then err = setVal(m,ad, P_read, username(ar))
if (!null err){
errorBox(err)
halt
}
}
SystemAdmin - Fri Nov 26 14:52:47 EST 2010 |
Re: For Access Rights in values Enumeration do If the attr already exists your code won't find it and so 'ad' is undefined. You should add "current = m" as the first line and uncomment "ad = find(m, "Change Proposal Status")" at about line 6, perhaps preceding it with 'else'. You -should- be getting an error at the 'specific' command. For whatever its worth, this code should insure the current user is a member of the 'dbgroup' group. In any event, perhaps your 'dbgroup' lacks full RMCDA rights to that attribute, and YOUR rights are getting reset to READ before you set full RMCDA rights to 'dbgroup'; so when you try you lack the rights to do so. So have two loops, 1st set dbgroup to RMCDA and 2nd set to R all others. Instead of a loop, I'd do this: set the default access to RMCDA (default is a null name) use unsetAllVal to remove all other accesses setVal dbgroup to RMCDA set the default access to R.
|
Re: For Access Rights in values Enumeration do
Hello Louie,
AccessRec ar
//create any enumeration attribute
AttrDef ad = create object type "Boolean" attribute "example"
//this line here generates the error -->
for ar in values ad do
{
print "Hello World!"
//do whatever I need to do with each ar
}
|
Re: For Access Rights in values Enumeration do SystemAdmin - Mon Nov 29 12:23:36 EST 2010
Hello Louie,
AccessRec ar
//create any enumeration attribute
AttrDef ad = create object type "Boolean" attribute "example"
//this line here generates the error -->
for ar in values ad do
{
print "Hello World!"
//do whatever I need to do with each ar
}
So you are getting intepret errors. I don't. Is it possible you have declared 'values' elsewhere as a function or a variable? BING BING BING I do get execution errors at the do loop because 'example' already exists and therefore the 'create' fails and therefore it returns a null AttrDef. You should check for its existence and ad = create it if not else ad = find it if so. Or attempt to ad=find it, if null ad then attempt to ad=create it, if null ad then stop this chore. CPS becomes remotely tolerable once you can display what exactly a CP will do when applied; functions and scripts and reports needed. It tricky looking at the Using flags, getting the Source attr value and using diff to the Proposed values, but once working its well worth it to provide the Board an actual report of what will happen. Even if you START with full RMCDA access, you can remove that access from yourself and then NO LONGER have RMCDA and cannot do more access chores to that attribute. Yes, someone else with RMCDA access can indeed lock you out easily on anything, by simply providing you specifically with R or None access. this sort of script is best run as the Administrator.
If this still fails, look up my profile and send me the script. |
Re: For Access Rights in values Enumeration do Thank you very much, I found my problem... Yes, some function to generate Dialog Boxes was redefining "values".... my bad. |